Allow /api/exit to stop all producers before terminating#2115
Open
btgoodwin wants to merge 7 commits intoAlexxIT:masterfrom
Open
Allow /api/exit to stop all producers before terminating#2115btgoodwin wants to merge 7 commits intoAlexxIT:masterfrom
/api/exit to stop all producers before terminating#2115btgoodwin wants to merge 7 commits intoAlexxIT:masterfrom
Conversation
In all cases where this was used by other packages, those packages also imported 'streams' and in some cases this eliminated the dependency on 'api' for that package.
/api/exit to stop all producers before terminating/api/exit to stop all producers before terminating
de88d89 to
72ef3b9
Compare
By moving these to a separate package, the other packages can refer to it, which leaves the original api package only as handlers for the top-level APIs. This also allows for those handlers to refer to the other packages.
Optional 'force' argument, when true, results in stopping all producers regardless of tracks, consumers, etc. This provides the application a means to "clean up" active streams.
This method iterates over all the stream instances and calls StopProducers(true) to force stopping all producers in every stream as a means to "clean up" those connections, if necessary.
By allowing all producers to stop, modules like rtsp will send 'TEARDOWN' messages to the remote device, allowing that remote device to free up any resources utilized by go2rtc to provide the stream during configuration.
72ef3b9 to
a1b5e75
Compare
This allows us to pass strings/characters to stdin for exec processes that can take a more graceful end.
This lets ffmpeg quit via passing 'q' to stdin, which is what it expects when run as a shell process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch refactors some code to make it possible for the
apipackage to refer to thestreamspackage so that the/api/exitendpoint can call a newstreamsAPI:StopAll. The method stops all producers of any kind. In the case ofrtspsources, this results in aTEARDOWNmessage being sent to the device, allowing it to free any onboard resources that were dedicated togo2rtchaving configured that source/stream.Fixes #2104
Testing (RTSP):
go2rtc.rtspsourcego2rtc1984 application page and create a tab from the configured source'sstreamlink./api/exitendpoint.terminated; if you observe this on Wireshark, you will see aTEARDOWNevent over port 554.